From 612d3bca7d24ab15fa73988cf02d41fd4da5522d Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sat, 12 Dec 2020 01:32:16 +0100 Subject: [PATCH] gtk/window: Bring back L-shaped resize corners These ended up square in the various refactors. Make them again L-shaped by extending these along the edge being checked. This means we have to check for corner positions in all edges, though. --- gtk/gtkwindow.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index c516bcdfc1..d3402c3a84 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1309,10 +1309,10 @@ get_edge_for_coordinates (GtkWindow *window, if (x < left && x >= left - handle_size.left) { - if (y < top && y >= top - handle_size.top) + if (y < top + handle_size.top && y >= top - handle_size.top) return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST); - if (y > top + border_rect->size.height && + if (y > top + border_rect->size.height - handle_size.bottom && y <= top + border_rect->size.height + handle_size.bottom) return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST); @@ -1321,24 +1321,36 @@ get_edge_for_coordinates (GtkWindow *window, else if (x > left + border_rect->size.width && x <= left + border_rect->size.width + handle_size.right) { - if (y < top && y >= top - handle_size.top) + if (y < top + handle_size.top && y >= top - handle_size.top) return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST); - if (y > top + border_rect->size.height && + if (y > top + border_rect->size.height - handle_size.bottom && y <= top + border_rect->size.height + handle_size.bottom) return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST); return edge_or_minus_one (GDK_SURFACE_EDGE_EAST); } - - if (y < top && y >= top - handle_size.top) + else if (y < top && y >= top - handle_size.top) { - /* NORTH_EAST is handled elsewhere */ + if (x < left + handle_size.left && x >= left - handle_size.left) + return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST); + + if (x > left + border_rect->size.width - handle_size.right && + x <= left + border_rect->size.width + handle_size.right) + return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST); + return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH); } else if (y > top + border_rect->size.height && y <= top + border_rect->size.height + handle_size.bottom) { + if (x < left + handle_size.left && x >= left - handle_size.left) + return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST); + + if (x > left + border_rect->size.width - handle_size.right && + x <= left + border_rect->size.width + handle_size.right) + return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST); + return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH); } -- 2.30.2